#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int x=0;
        for(auto& i:nums)
        {
            if(i!=nums[x])
            {
                x++;
                nums[x]=i;
            }
        }
        return x+1;
    }
};